﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using TCEasyPrintRev.Controllers;
using TCEasyPrintRev.Models;

namespace TCEasyPrintRev.WCF_member
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "MemberService" in code, svc and config file together.
    public class MemberService : IMemberService
    {
        //RegisterMember
        public bool Authenticate(string password, string email)
        {

            return MemberController.Login(password, email);


        }


        public bool register(MemberS member, string kata, string captcha)
        {


            if (kata == captcha)
            {
               
               
                MemberController.register(member);



                return true;
            }

            else return false;


        }

        public string randomText()
        {
            StringBuilder randomText = new StringBuilder();

            string kata;
            string alphabets = "abcdefghijklmnopqrstuvwxyz";

            Random r = new Random();
            for (int j = 0; j <= 5; j++)
            {

                randomText.Append(alphabets[r.Next(alphabets.Length)]);
            }

            kata = randomText.ToString();


            return kata;

        }
    }
}
